﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://www.resamu.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ResaFixml
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function Test(ByVal idresamu As String, ByVal pwd As String, ByVal idpers As String) As String
        Dim message As String
        Dim ResaUser As New ResaUser.user
        ResaUser.Timeout = 60000
        ResaUser.Url = Application("ResaUser")
        message = ResaUser.Identification(idresamu, pwd, idpers)
        Dim LOG As New ResaLog.logsurvey
        LOG.Timeout = 60000
        LOG.Url = Application("ResaLog")
        LOG.NewLog(idresamu, "WSFIXML", "WSFIXML", "TEST", message)
        Return message
    End Function
    <WebMethod()> _
   Public Function GetFixmlStructure(ByVal idresamu As String, ByVal pwd As String, ByVal idpers As String) As System.Xml.XmlDocument
        Dim message As String
        Dim xmldata As New System.Xml.XmlDocument
        Dim USERLOG As New ResaUser.user
        'penser à gérer l'adresse du WS
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1
        message = USERLOG.Identification(idresamu, pwd, idpers)
        Dim data As String() = message.Split("/")
        If data(0) = "IDOK" Then
            xmldata.Load(Server.MapPath("App_Data\fixml.xml"))
        End If
        Return xmldata
    End Function
    <WebMethod()> _
    Public Function NewFiXmlString(ByVal idresamu As String, ByVal pwd As String, ByVal idteam As String, _
    ByVal idpers As String, ByVal fixml_s As String) As String

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaMessage As New ResaMessage.ResaMessage
        ResaMessage.Url = Application("ResaMessage")
        ResaMessage.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim fixml As New System.Xml.XmlDocument
        fixml.LoadXml(fixml_s)
        Dim message, securite(), localid, resaid, commune, codep, pays, utmx, utmy As String
        Dim dbFixml As New DataSetFixmlTableAdapters.list_itvTableAdapter
        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            Try
                If securite(0) = "IDOK" Then
                    'on analyse le fichier xml transmis
                    localid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("id").InnerText
                    commune = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText
                    codep = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText
                    pays = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText
                    utmx = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText
                    utmy = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText
                    'on génére une idresamu pour l'itv
                    resaid = CStr(Now.Year) + CStr(Now.Month) + CStr(Now.Day) + CStr(Now.Hour) + _
                    CStr(Now.Minute) + CStr(Now.Second) + CStr(Now.Millisecond) + CStr(Now.Ticks)
                    'on insère l'identite dans le doc
                    Dim xmlnode As System.Xml.XmlNode
                    xmlnode = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("resaid")
                    xmlnode.InnerText = resaid
                    'on insére l'itv dans la base
                    dbFixml.Insert(resaid, localid, securite(5), idresamu, idteam, Now(), idresamu, idteam, Now(), Now(), commune, codep, utmx, utmy, pays, fixml.InnerXml)
                    message = "NEWFIXMLOK/" + resaid
                    'WS de messagerie nouvelle itv
                    Dim equipe As System.Xml.XmlNode
                    Dim liste As System.Xml.XmlNodeList
                    liste = fixml.DocumentElement.SelectNodes("equipe")
                    For Each equipe In liste
                        If equipe.SelectSingleNode("idresamu").InnerText <> "" Then
                            ResaMessage.NewMessageSystem(equipe.SelectSingleNode("idresamu").InnerText, _
                            equipe.SelectSingleNode("idteam").InnerText, resaid, "NEWITV")
                        End If
                    Next
                Else
                    message = "ERROR/INTRUSION"
                End If
            Catch ex As Exception
                message = "ERROR/" + ex.Message
            End Try
        Catch ex As Exception
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "NewFixmlString", message)
        Return message
    End Function
    <WebMethod()> _
    Public Function NewFixmlXml(ByVal idresamu As String, ByVal pwd As String, ByVal idteam As String, _
    ByVal idpers As String, ByVal fixml As System.Xml.XmlDocument) As String

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaMessage As New ResaMessage.ResaMessage
        ResaMessage.Url = Application("ResaMessage")
        ResaMessage.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim message, securite(), localid, resaid, commune, codep, pays, utmx, utmy As String
        Dim dbFixml As New DataSetFixmlTableAdapters.list_itvTableAdapter
        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            If securite(0) = "IDOK" Then
                'on analyse le fichier xml transmis
                localid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("id").InnerText
                commune = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText
                codep = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText
                pays = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText
                utmx = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText
                utmy = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText
                'on génére une idresamu pour l'itv
                resaid = CStr(Now.Year) + CStr(Now.Month) + CStr(Now.Day) + CStr(Now.Hour) + _
                CStr(Now.Minute) + CStr(Now.Second) + CStr(Now.Millisecond) + CStr(Now.Ticks)
                'on insère l'identite dans le doc
                Dim xmlnode As System.Xml.XmlNode
                xmlnode = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("resaid")
                xmlnode.InnerText = resaid
                'on insére l'itv dans la base
                dbFixml.Insert(resaid, localid, securite(5), idresamu, idteam, Now(), idresamu, idteam, Now(), Now(), commune, codep, utmx, utmy, pays, fixml.InnerXml)
                message = "NEWFIXMLOK/" + resaid
                'WS de messagerie nouvelle itv
                Dim equipe As System.Xml.XmlNode
                Dim liste As System.Xml.XmlNodeList
                liste = fixml.DocumentElement.SelectNodes("equipe")
                For Each equipe In liste
                    If equipe.SelectSingleNode("idresamu").InnerText <> "" Then
                        ResaMessage.NewMessageSystem(equipe.SelectSingleNode("idresamu").InnerText, _
                        equipe.SelectSingleNode("idteam").InnerText, resaid, "NEWITV")
                    End If
                Next
            Else
                message = "ERROR/INTRUSION"
            End If
        Catch ex As Exception
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "NewFixmlXml", message)
        Return message
    End Function
    <WebMethod()> _
    Public Function UpdateFixmlString(ByVal idresamu As String, ByVal pwd As String, ByVal idteam As String, _
    ByVal idpers As String, ByVal fixml_s As String) As String

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaMessage As New ResaMessage.ResaMessage
        ResaMessage.Url = Application("ResaMessage")
        ResaMessage.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim fixml As New System.Xml.XmlDocument
        fixml.LoadXml(fixml_s)

        Dim message, securite(), localid, resaid, commune, codep, pays, utmx, utmy As String
        Dim dbFixml As New DataSetFixmlTableAdapters.list_itvTableAdapter
        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            Try
                If securite(0) = "IDOK" Then
                    'on analyse le fichier xml transmis
                    localid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("id").InnerText
                    commune = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText
                    codep = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText
                    pays = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText
                    utmx = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText
                    utmy = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText
                    'on récupère le resaid
                    resaid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("resaid").InnerText
                    'on update l'itv dans la base
                    dbFixml.UpdateQueryByResaId(idresamu, idteam, Now(), Now(), commune, codep, utmx, utmy, pays, fixml.InnerXml, resaid)
                    message = "UPDATEFIXMLOK/" + resaid
                    'WS de messagerie nouvelle itv
                    Dim equipe As System.Xml.XmlNode
                    Dim liste As System.Xml.XmlNodeList
                    liste = fixml.DocumentElement.SelectNodes("equipe")
                    For Each equipe In liste
                        If equipe.SelectSingleNode("idresamu").InnerText <> "" Then
                            ResaMessage.NewMessageSystem(equipe.SelectSingleNode("idresamu").InnerText, _
                            equipe.SelectSingleNode("idteam").InnerText, resaid, "MAJITV")
                        End If
                    Next
                Else
                    message = "ERROR/INTRUSION"
                End If
            Catch ex As Exception
                message = "ERROR/" + ex.Message
            End Try
        Catch ex As Exception
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "UpdateFixmlString", message)
        Return message
    End Function
    <WebMethod()> _
    Public Function UpdateFixmlXml(ByVal idresamu As String, ByVal pwd As String, ByVal idteam As String, _
    ByVal idpers As String, ByVal fixml As System.Xml.XmlDocument) As String

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaMessage As New ResaMessage.ResaMessage
        ResaMessage.Url = Application("ResaMessage")
        ResaMessage.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim message, securite(), localid, resaid, commune, codep, pays, utmx, utmy As String
        Dim fixml_old As New System.Xml.XmlDocument

        Dim dbFixml As New DataSetFixmlTableAdapters.list_itvTableAdapter
        Dim data As New DataSetFixml.list_itvDataTable

        Dim liste As System.Xml.XmlNodeList
        Dim itema, itemb As System.Xml.XmlNode
        Dim elementa, elementb As System.Xml.XmlElement

        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            Try
                If securite(0) = "IDOK" Then
                    'on analyse le fichier xml transmis
                    localid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("id").InnerText
                    commune = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText
                    codep = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText
                    pays = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText
                    utmx = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText
                    utmy = fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText
                    'on récupère le resaid
                    resaid = fixml.DocumentElement.SelectSingleNode("id").SelectSingleNode("resaid").InnerText
                    'on récupère la fiche dans la base
                    data = dbFixml.GetDataByResaId(resaid)
                    fixml_old.LoadXml(data(0).fixml)
                    'on met à jour les noeud fixes de fmxml_old
                    'A/mise à jour de l'adresse
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("num").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("num").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("rue").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("rue").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("codep").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("com").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("pays").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmx").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("adresse").SelectSingleNode("utmy").InnerText
                    'B/mise à jour du noeud appelant
                    fixml_old.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("nom").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("nom").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("prenom").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("prenom").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("tel").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("tel").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("qui").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("appelant").SelectSingleNode("qui").InnerText
                    'C/mise à jour du noeud typo
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("activite").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("activite").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("profession").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("profession").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("milieu").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("milieu").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("meteo").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("meteo").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("AVP").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("AVP").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("typo").SelectSingleNode("AT").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("typo").SelectSingleNode("AT").InnerText
                    'D/mise à jour du noeud motif
                    fixml_old.DocumentElement.SelectSingleNode("motif").SelectSingleNode("cim10").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("motif").SelectSingleNode("cim10").InnerText
                    fixml_old.DocumentElement.SelectSingleNode("motif").SelectSingleNode("lib").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("motif").SelectSingleNode("lib").InnerText
                    'fixml_old.DocumentElement.SelectSingleNode("motif").SelectSingleNode("type").InnerText = _
                    'fixml.DocumentElement.SelectSingleNode("motif").SelectSingleNode("type").InnerText
                    'E/mise à jour du noeud regprocess
                    fixml_old.DocumentElement.SelectSingleNode("regprocess").InnerText = _
                    fixml.DocumentElement.SelectSingleNode("regprocess").InnerText
                    'on analyse les noeuds avec id vide du nouveau fixml
                    'analyse des noeud equipe
                    liste = fixml.DocumentElement.SelectNodes("equipe")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            elementa = fixml_old.CreateElement(itema.Name)
                            For Each itemb In itema.ChildNodes
                                elementb = fixml_old.CreateElement(itemb.Name)
                                elementb.InnerText = itemb.InnerText
                                elementa.AppendChild(elementb)
                            Next
                            fixml_old.DocumentElement.AppendChild(elementa)
                        End If
                    Next
                    liste = fixml_old.DocumentElement.SelectNodes("equipe")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            itema.SelectSingleNode("id").InnerText = idresamu + "/" + idteam + "/" + _
                            CStr(Now.Year) + CStr(Now.Month) + CStr(Now.Day) + CStr(Now.Hour) + CStr(Now.Minute) + CStr(Now.Second) + CStr(Now.Millisecond)
                        End If
                    Next
                    'analyse des noeuds pat
                    liste = fixml.DocumentElement.SelectNodes("pat")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            elementa = fixml_old.CreateElement(itema.Name)
                            For Each itemb In itema.ChildNodes
                                elementb = fixml_old.CreateElement(itemb.Name)
                                elementb.InnerText = itemb.InnerText
                                elementa.AppendChild(elementb)
                            Next
                            fixml_old.DocumentElement.AppendChild(elementa)
                        End If
                    Next
                    liste = fixml_old.DocumentElement.SelectNodes("pat")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            itema.SelectSingleNode("id").InnerText = idresamu + "/" + idteam + "/" + _
                            CStr(Now.Year) + CStr(Now.Month) + CStr(Now.Day) + CStr(Now.Hour) + CStr(Now.Minute) + CStr(Now.Second) + CStr(Now.Millisecond)
                        End If
                    Next
                    'analyse des noeuds obs
                    liste = fixml.DocumentElement.SelectNodes("obs")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            elementa = fixml_old.CreateElement(itema.Name)
                            For Each itemb In itema.ChildNodes
                                elementb = fixml_old.CreateElement(itemb.Name)
                                elementb.InnerText = itemb.InnerText
                                elementa.AppendChild(elementb)
                            Next
                            fixml_old.DocumentElement.AppendChild(elementa)
                        End If
                    Next
                    liste = fixml_old.DocumentElement.SelectNodes("obs")
                    For Each itema In liste
                        If itema.SelectSingleNode("id").InnerText = "" Then
                            itema.SelectSingleNode("id").InnerText = idresamu + "/" + idteam + "/" + _
                            CStr(Now.Year) + CStr(Now.Month) + CStr(Now.Day) + CStr(Now.Hour) + CStr(Now.Minute) + CStr(Now.Second) + CStr(Now.Millisecond)
                        End If
                    Next
                    'on update l'itv dans la base
                    dbFixml.UpdateQueryByResaId(idresamu, idteam, Now(), Now(), commune, codep, utmx, utmy, pays, fixml_old.InnerXml, resaid)
                    message = "UPDATEFIXMLOK/" + resaid
                    'WS de messagerie nouvelle itv
                    Dim equipe As System.Xml.XmlNode
                    liste = fixml.DocumentElement.SelectNodes("equipe")
                    For Each equipe In liste
                        If equipe.SelectSingleNode("idresamu").InnerText <> "" Then
                            If equipe.SelectSingleNode("idresamu").InnerText <> "" Then
                                ResaMessage.NewMessageSystem(equipe.SelectSingleNode("idresamu").InnerText, _
                                equipe.SelectSingleNode("idteam").InnerText, resaid, "MAJITV")
                            End If
                        End If
                    Next
                Else
                    message = "ERROR/INTRUSION"
                End If
            Catch ex As Exception
                message = "ERROR/" + ex.Message
            End Try
        Catch ex As Exception
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "UpdateFixmlString", message)
        Return message
    End Function
    <WebMethod()> _
    Public Function GetFixmlData(ByVal idresamu As String, ByVal idteam As String, ByVal pwd As String, ByVal resaid As String, ByVal idpers As String) As System.Xml.XmlDocument

        Dim FIXML As New System.Xml.XmlDocument

        Dim dbFIXML As New DataSetFixmlTableAdapters.list_itvTableAdapter
        Dim datafixml As New DataSetFixml.list_itvDataTable
        Dim XmlListe As System.Xml.XmlNodeList
        Dim xmlnode As System.Xml.XmlNode

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim securite(), message As String

        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            If securite(0) = "IDOK" Then
                Dim flag As Boolean = False
                datafixml = dbFIXML.GetDataByResaId(resaid)
                If datafixml.Rows.Count = 0 Then
                    FIXML.LoadXml("<message>PASDEFICHE</message>")
                Else
                    FIXML.LoadXml(datafixml(0).fixml)
                    XmlListe = FIXML.DocumentElement.SelectNodes("equipe")
                    For Each xmlnode In XmlListe
                        If xmlnode.SelectSingleNode("idresamu").InnerText = idresamu Then
                            flag = True
                            Exit For
                        End If
                    Next
                    Select Case flag
                        Case False
                            FIXML.LoadXml("<message>ERROR/NONDEST</message>")
                            message = "ERROR/NONDEST"
                        Case True
                            message = "GETFIXMLDATAOK"
                    End Select
                End If
            Else
                FIXML.LoadXml("<message>ERROR/INTRUSION</message>")
                message = "ERROR/INTRUSION"
            End If
        Catch ex As Exception
            FIXML.LoadXml("<message>ERROR/" + ex.Message + "</message>")
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "GetFixmlData", message)
        Return FIXML
    End Function
    <WebMethod()> _
    Public Function GetListItv(ByVal idresamu As String, ByVal idteam As String, _
    ByVal pwd As String, ByVal idpers As String) As System.Xml.XmlDocument

        Dim ListeFixml As New System.Xml.XmlDocument

        Dim USERLOG As New ResaUser.user
        USERLOG.Url = Application("ResaUser")
        USERLOG.Timeout = -1

        Dim ResaLog As New ResaLog.logsurvey
        ResaLog.Url = Application("ResaLog")
        ResaLog.Timeout = -1

        Dim securite(), message As String

        Try
            securite = USERLOG.Identification(idresamu, pwd, idpers).Split("/")
            If securite(0) = "IDOK" Then
                Dim dbFIXML As New DataSetFixmlTableAdapters.list_itvTableAdapter
                Dim data As New DataSetFixml.list_itvDataTable
                data = dbFIXML.GetDataBySamu(securite(5))
                data.WriteXml(Server.MapPath("") + "/XML/" + idresamu + idteam + ".xml")
                ListeFixml.Load(Server.MapPath("") + "/XML/" + idresamu + idteam + ".xml")
                message = "GETLISTITVOK"
            Else
                ListeFixml.LoadXml("<message>ERROR/INTRUSION</message>")
                message = "ERROR/INTRUSION"
            End If

        Catch ex As Exception
            ListeFixml.LoadXml("<message>ERROR/" + ex.Message + "</message>")
            message = "ERROR/" + ex.Message
        End Try
        ResaLog.NewLog(idresamu, idteam, idpers, "GetListItv", message)
        Return ListeFixml
    End Function

End Class
